package com.jianganming.proxy.statics;

/**
 * 静态代理
 */
public class ProxyPoint implements TrainStation{
    private TrainStation station;

    public ProxyPoint(TrainStation station) {
        this.station = station;
    }

    @Override
    public double sellTickets() {
        double price = station.sellTickets();
        double price1 = price + (price * 0.05);
        System.out.println("代售收取5%手续费,原价："+price+",现价:"+price1);
        return price1;
    }

    public static void main(String[] args) {
        ProxyPoint proxyPoint = new ProxyPoint(new GuangzhouTrainStation());
        proxyPoint.sellTickets();
    }
}

interface TrainStation{
    //售票
    double sellTickets();
}

//目标类
class GuangzhouTrainStation implements TrainStation{
    private double price;

    @Override
    public double sellTickets() {
        price = 200d;
        System.out.println("广州火车站卖票");
        return price;
    }
}
